home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 10 / The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso / PC_SIGCD / 22 / 4 / DISK2247.ZIP / CBASE101.ZIP / CBASE.ZIP / CBASE_.H next >
Text File  |  1990-06-21  |  3KB  |  91 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)cbase_.h    1.4 - 90/06/20" */
  5.  
  6. /*man---------------------------------------------------------------------------
  7. NAME
  8.      cbase_.h - private header file for cbase library
  9.  
  10. SYNOPSIS
  11.      #include "cbase_.h"
  12.  
  13. DESCRIPTION
  14.      This is a private header file included by the cbase library
  15.      modules.
  16.  
  17. ------------------------------------------------------------------------------*/
  18. #ifndef CBASE_H_    /* prevent multiple includes */
  19. #define CBASE_H_
  20.  
  21. /*#define DEBUG        /* switch to enable debugging for cbase library */
  22.  
  23. /* ansi headers */
  24. #include <stdio.h>
  25.  
  26. /* non-ansi headers */
  27. #include <bool.h>
  28.  
  29. /* local headers */
  30. #include "cbase.h"
  31.  
  32. /* constants */
  33. #define CBTYPECNT        ((size_t)27)
  34. #define EXPFLDDLM ('|')        /* export field delimiter */
  35. #define EXPRECDLM ('\n')    /* export record delimiter */
  36. #define EXPESC    ('\\')        /* export field escape character */
  37. #define CB_READ    ("r")        /* cbase open types */
  38. #define CB_RDWR    ("r+")
  39.  
  40. /* tables */
  41. #ifdef AC_PROTO
  42. extern cbase_t cbb[CBOPEN_MAX];    /* cbase control structure table declaration */
  43. typedef int (*cbcmp_t)(const void *p1, const void *p2, size_t n);
  44. extern const cbcmp_t cbcmpv[CBTYPECNT];    /* comparison function table decl. */
  45. typedef int (*cbexp_t)(FILE *fp, const void *p, size_t n);
  46. extern const cbexp_t cbexpv[CBTYPECNT];    /* export function table decl. */
  47. typedef int (*cbimp_t)(FILE *fp, const void *p, size_t n);
  48. extern const cbimp_t cbimpv[CBTYPECNT];    /* import function table decl. */
  49. #else
  50. extern cbase_t cbb[CBOPEN_MAX];    /* cbase control structure table declaration */
  51. typedef int (*cbcmp_t)();
  52. extern cbcmp_t cbcmpv[CBTYPECNT];    /* comparison function table decl. */
  53. typedef int (*cbexp_t)();
  54. extern cbexp_t cbexpv[CBTYPECNT];    /* export function table decl. */
  55. typedef int (*cbimp_t)();
  56. extern cbimp_t cbimpv[CBTYPECNT];    /* import function table decl. */
  57. #endif    /* #ifdef AC_PROTO */
  58.  
  59. /* cbase_t bit flags */
  60. #define CBOPEN          (03)    /* open status bits */
  61. #define CBREAD          (01)    /* cbase is open for reading */
  62. #define CBWRITE          (02)    /* cbase is open for writing */
  63. #define CBLOCKS         (030)    /* lock status bits */
  64. #define CBRDLCK         (010)    /* cbase is read locked */
  65. #define CBWRLCK         (020)    /* cbase is write locked */
  66. #define CBERR        (0100)    /* error has occurred on this cbase */
  67.  
  68. /* function declarations */
  69. #ifdef AC_PROTO
  70. int    cb_alloc(cbase_t *cbp);
  71. void    cb_free(cbase_t *cbp);
  72. bool    cb_fvalid(size_t recsize, int fldc, const cbfield_t fldv[]);
  73. bool    cb_valid(cbase_t *cbp);
  74. #else
  75. int    cb_alloc();
  76. void    cb_free();
  77. bool    cb_fvalid();
  78. bool    cb_valid();
  79. #endif    /* #ifdef AC_PROTO */
  80.  
  81. #ifdef DEBUG
  82. #define    CBEPRINT {                            \
  83.     fprintf(stderr, "cbase error line %d of %s. errno = %d.\n",    \
  84.         __LINE__, __FILE__, errno);                \
  85. }
  86. #else
  87. #define CBEPRINT
  88. #endif
  89.  
  90. #endif        /* #ifndef CBASE_H_ */
  91.